#ifndef __OPENGLDRIVER_H__
#define __OPENGLDRIVER_H__

#include "../Null/NullDriver.h"
#include "../../Config.h"
#include "../../DrawableFaceManager.h"

class COpenGLDriver : public CNullDriver
{
private:
	f32 amb[4];
	f32 dif[4];
	f32 spec[4];

protected:
	bool UseVertexArray;

	virtual void Apply2DView();
	virtual void Apply3DView();
public:
	COpenGLDriver(StartDriverParams *DrvParams);
	~COpenGLDriver();

	virtual void InitDriver();

	virtual void BeginRender();
	virtual void EndRender();

	virtual void InitProjectionMatrix();
	virtual void InitViewMatrix();

	void ClearBuffers(bool backBuffer, bool zBuffer, bool stencilBuffer, CColor &color);
	void DoRender3D(IDrawableFace *df);
	void DoRender3DVertexArray(IDrawableFace *df);
	void DoRender2D(IDrawableFace *df);
	void Apply3DCamera(I3DCameraSceneNode *cam);
	void Apply2DCamera(I2DCameraSceneNode *cam);
	void ApplyLight(IRenderizableLight *Light,u32 IndexLight);
	void ApplyMaterial3D(IMaterial *mat);
	void ApplyMaterial2D(IMaterial *mat);

	virtual vector2dvpos GetPositionIn2D(const vector2dvpos &Position);
	virtual vPos GetPositionIn2DX(vPos PosX);
	virtual vPos GetPositionIn2DY(vPos PosY);

};
#endif
